package com.shen.yun.vo;

import javax.websocket.Session;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;

public class Room {
    private String roomId;

    //剩余玩家数量
    private volatile int leftPlayerNum;

    //静态变量，用来记录当前房间在线连接数。应该把它设计成线程安全的。
    private volatile int onlineCount;

    //房间用户Set，用来记录昵称和该session进行绑定
    private volatile Map<String, Session> nameToSessionmap;

    //保存已攻击玩家信息
    private volatile List<User> AttackedUserSet;

    //已准备下一局的玩家数量
    private volatile List<String> ReadyUserSet;

    public Room(String roomId, int leftPlayerNum){
        this.roomId = roomId;
        this.leftPlayerNum = leftPlayerNum;
        this.onlineCount = 0;
        this.nameToSessionmap = new HashMap<>();
        this.AttackedUserSet = new ArrayList<>();
        this.ReadyUserSet = new ArrayList<>();
    }


    public String getRoomId() {
        return roomId;
    }

    public void setRoomId(String roomId) {
        this.roomId = roomId;
    }

    public int getLeftPlayerNum() {
        return leftPlayerNum;
    }

    public void setLeftPlayerNum(int leftPlayerNum) {
        this.leftPlayerNum = leftPlayerNum;
    }

    public int getOnlineCount() {
        return onlineCount;
    }

    public void setOnlineCount(int onlineCount) {
        this.onlineCount = onlineCount;
    }

    public Map<String, Session> getNameToSessionmap() {
        return nameToSessionmap;
    }

    public void setNameToSessionmap(Map<String, Session> nameToSessionmap) {
        this.nameToSessionmap = nameToSessionmap;
    }

    public List<User> getAttackedUserSet() {
        return AttackedUserSet;
    }

    public void setAttackedUserSet(List<User> attackedUserSet) {
        AttackedUserSet = attackedUserSet;
    }

    public List<String> getReadyUserSet() {
        return ReadyUserSet;
    }

    public void setReadyUserSet(List<String> readyUserSet) {
        ReadyUserSet = readyUserSet;
    }
}
